# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=polyswarm
pkgver=3.14.0
pkgrel=2
pkgdesc='An interface to the public and private PolySwarm APIs.'
groups=('blackarch' 'blackarch-malware' 'blackarch-defensive')
arch=('any')
url='https://github.com/polyswarm/polyswarm-api'
license=('MIT')
replaces=('polyswarm-api')
provides=('polyswarm' 'polyswarm-api' 'polyswarm-cli')
depends=('python' 'python-virtualenv')
makedepends=('git' 'python-pip')
install="$pkgname.install"

prepare() {
  mkdir -p $pkgname
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
source /usr/share/$pkgname/venv/bin/activate
exec python /usr/share/$pkgname/venv/bin/$pkgname "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

